package tritop.android.a4dinfo;

import java.io.File;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.ImageView;

public class A4DInfo extends Activity {
	
	public static final String INTENT_COUNTRYCODE="CCODE";
	public static final int COUNTRYCODE_DE=0;
	public static final int COUNTRYCODE_BW=1;
	public static final int COUNTRYCODE_BY=2;
	public static final int COUNTRYCODE_BE=3;
	public static final int COUNTRYCODE_BB=4;
	public static final int COUNTRYCODE_HB=5;
	public static final int COUNTRYCODE_HH=6;
	public static final int COUNTRYCODE_HE=7;
	public static final int COUNTRYCODE_MV=8;
	public static final int COUNTRYCODE_NI=9;
	public static final int COUNTRYCODE_NW=10;
	public static final int COUNTRYCODE_RP=11;
	public static final int COUNTRYCODE_SL=12;
	public static final int COUNTRYCODE_SN=13;
	public static final int COUNTRYCODE_ST=14;
	public static final int COUNTRYCODE_SH=15;
	public static final int COUNTRYCODE_TH=16;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.main);
        setupButtonListeners();
        DBHelper dbhlp= new DBHelper(this);
        dbhlp.getAvailableStats(2);
        dbhlp.close();
    }
    
    
    
    /**************************************************************************
     * setup all button click listeners with extra country code intent Data
     **************************************************************************/
    
    private void setupButtonListeners(){
    	ImageView im = (ImageView) this.findViewById(R.id.imageViewBW);
    	im.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(A4DInfo.this,StatsShow.class);
				intent.putExtra(INTENT_COUNTRYCODE, COUNTRYCODE_BW);
				startActivity(intent);
				
			}
    	});
    	
    	im = (ImageView) this.findViewById(R.id.imageViewBY);
    	im.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(A4DInfo.this,StatsShow.class);
				intent.putExtra(INTENT_COUNTRYCODE, COUNTRYCODE_BY);
				startActivity(intent);
				
			}
    	});
    	
    	im = (ImageView) this.findViewById(R.id.imageViewBE);
    	im.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(A4DInfo.this,StatsShow.class);
				intent.putExtra(INTENT_COUNTRYCODE, COUNTRYCODE_BE);
				startActivity(intent);
				
			}
    	});
    	
    	im = (ImageView) this.findViewById(R.id.imageViewBB);
    	im.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(A4DInfo.this,StatsShow.class);
				intent.putExtra(INTENT_COUNTRYCODE, COUNTRYCODE_BB);
				startActivity(intent);
				
			}
    	});
    	
    	im = (ImageView) this.findViewById(R.id.imageViewHB);
    	im.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(A4DInfo.this,StatsShow.class);
				intent.putExtra(INTENT_COUNTRYCODE, COUNTRYCODE_HB);
				startActivity(intent);
				
			}
    	});
    	
    	im = (ImageView) this.findViewById(R.id.imageViewHH);
    	im.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(A4DInfo.this,StatsShow.class);
				intent.putExtra(INTENT_COUNTRYCODE, COUNTRYCODE_HH);
				startActivity(intent);
				
			}
    	});
    	
    	im = (ImageView) this.findViewById(R.id.imageViewHE);
    	im.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(A4DInfo.this,StatsShow.class);
				intent.putExtra(INTENT_COUNTRYCODE, COUNTRYCODE_HE);
				startActivity(intent);
				
			}
    	});
    	
    	im = (ImageView) this.findViewById(R.id.imageViewMV);
    	im.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(A4DInfo.this,StatsShow.class);
				intent.putExtra(INTENT_COUNTRYCODE, COUNTRYCODE_MV);
				startActivity(intent);
				
			}
    	});
    	
    	im = (ImageView) this.findViewById(R.id.imageViewNI);
    	im.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(A4DInfo.this,StatsShow.class);
				intent.putExtra(INTENT_COUNTRYCODE, COUNTRYCODE_NI);
				startActivity(intent);
				
			}
    	});
    	
    	
    	im = (ImageView) this.findViewById(R.id.imageViewNW);
    	im.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(A4DInfo.this,StatsShow.class);
				intent.putExtra(INTENT_COUNTRYCODE, COUNTRYCODE_NW);
				startActivity(intent);
				
			}
    	});
    	
    	im = (ImageView) this.findViewById(R.id.imageViewRP);
    	im.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(A4DInfo.this,StatsShow.class);
				intent.putExtra(INTENT_COUNTRYCODE, COUNTRYCODE_RP);
				startActivity(intent);
				
			}
    	});
    	
    	im = (ImageView) this.findViewById(R.id.imageViewSL);
    	im.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(A4DInfo.this,StatsShow.class);
				intent.putExtra(INTENT_COUNTRYCODE, COUNTRYCODE_SL);
				startActivity(intent);
				
			}
    	});
    	
    	im = (ImageView) this.findViewById(R.id.imageViewSN);
    	im.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(A4DInfo.this,StatsShow.class);
				intent.putExtra(INTENT_COUNTRYCODE, COUNTRYCODE_SN);
				startActivity(intent);
				
			}
    	});
    	
    	im = (ImageView) this.findViewById(R.id.imageViewST);
    	im.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(A4DInfo.this,StatsShow.class);
				intent.putExtra(INTENT_COUNTRYCODE, COUNTRYCODE_ST);
				startActivity(intent);
				
			}
    	});
    	
    	im = (ImageView) this.findViewById(R.id.imageViewSH);
    	im.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(A4DInfo.this,StatsShow.class);
				intent.putExtra(INTENT_COUNTRYCODE, COUNTRYCODE_SH);
				startActivity(intent);
				
			}
    	});
    	
    	im = (ImageView) this.findViewById(R.id.imageViewTH);
    	im.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(A4DInfo.this,StatsShow.class);
				intent.putExtra(INTENT_COUNTRYCODE, COUNTRYCODE_TH);
				startActivity(intent);
				
			}
    	});
    }
}

